package com.tomshushu.doc.freedoc.modular.project.controller;

import com.tomshushu.doc.freedoc.core.model.response.ResponseData;
import com.tomshushu.doc.freedoc.core.model.response.SuccessResponseData;
import com.tomshushu.doc.freedoc.modular.project.model.param.AddProjectParam;
import com.tomshushu.doc.freedoc.modular.project.model.param.DeleteProjectParam;
import com.tomshushu.doc.freedoc.modular.project.model.param.EditProjectParam;
import com.tomshushu.doc.freedoc.modular.project.service.ProjectService;
import com.tomshushu.doc.freedoc.modular.team.model.param.DeleteTeamParam;
import com.tomshushu.doc.freedoc.modular.team.model.param.EditTeamParam;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/doc/project")
public class ProjectController {

    @Resource
    private ProjectService projectService;

    @PostMapping("/addProject")
    public ResponseData addProject(@RequestBody AddProjectParam addProjectParam) {
        projectService.addProject(addProjectParam);
        return new SuccessResponseData();
    }

    @PostMapping("/deleteProject")
    public ResponseData deleteProject(@RequestBody DeleteProjectParam param) {
        projectService.deleteProject(param);
        return new SuccessResponseData();
    }

    @PostMapping("/editProject")
    public ResponseData editProject(@RequestBody EditProjectParam param) {
        projectService.editProject(param);
        return new SuccessResponseData();
    }

    @PostMapping("/statistics")
    public ResponseData statisticsProject(@RequestBody DeleteProjectParam param) {
        return new SuccessResponseData(projectService.statistics(param));
    }

    @PostMapping("/getProjectInfo")
    public ResponseData getProjectInfo(@RequestBody DeleteProjectParam param) {
        return new SuccessResponseData(projectService.getProjectInfo(param));
    }

}